package com.jiuwu.spring.eshop.respository;

import com.jiuwu.spring.eshop.db.entity.OrderEt;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Transactional
public interface OrderRepository extends JpaRepository<OrderEt,Integer> {

    @Modifying
    @Query(value = "update OrderEt set isEnforce = ?2 where orderID = ?1")
    void updateOrderInfo(Integer orderID,Integer isEnforce);


    List<OrderEt> findAllByOrderNameEquals(String orderName);

    Page<OrderEt> findAll(Pageable pageable);
}
